/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gerenciadoc.dao;

import gerenciadoc.bean.Documento;
import gerenciadoc.utils.HibernateUtil;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;

/**
 *
 * @author Rafael
 */
public class DocumentoDAO extends GenericaDAO<Documento> {
    
    private final Session s;

    public DocumentoDAO()
    {
        s = HibernateUtil.getSessionFactory().openSession();
    }

        public List<Documento> list() {

        try {
            String sql = "from Documento";
            Query qr = s.createQuery(sql);
            return (List<Documento>) qr.list();
        } finally {
            s.close();
        }
    }


}
